﻿@page
<!DOCTYPE html>
<html>
<head>
    <title>System.IO.MemoryMappedFiles.MemoryMappedFile性能测试</title>
    <link href="~/css/site.css" rel="stylesheet" />
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script src="~/lib/echarts.min.js"></script>
    <script type="text/javascript">
        $(function () {
            setPerformanceChart('', '4K顺序写入', '/Home/MemoryMapSequenceWrite4K');
            setPerformanceChart('SequenceWrite1K', '1K顺序写入', '/Home/MemoryMapSequenceWrite1K');
            setPerformanceChart('SequenceWrite4K', '4K顺序写入', '/Home/MemoryMapSequenceWrite4K');
            setPerformanceChart('SequenceWrite8K', '8K顺序写入', '/Home/MemoryMapSequenceWrite8K');
        });
        function setPerformanceChart(chartId, name, dataUrl) {
            $.ajax(dataUrl, { async: false, dataType: 'JSON' }).done(function (data) {
                if (!chartId) return;
                // 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById(chartId));
                var xAxisData = [];
                var seriesData = [];
                for (var i in data) {
                    xAxisData.push(data[i].elapsedSeconds);
                    seriesData.push(data[i].writeByteCount);
                }
                // 指定图表的配置项和数据
                var option = {
                    title: {
                        text: name
                    },
                    tooltip: {},
                    legend: {
                        data: ['写入量MB/S']
                    },
                    xAxis: {
                        data: xAxisData
                    },
                    yAxis: {max:500},
                    series: [{
                        name: '写入量MB/S',
                        type: 'bar',
                        data: seriesData
                    }]
                };
                // 使用刚指定的配置项和数据显示图表。
                myChart.setOption(option);
            });

        }
    </script>
</head>
<body>
    <div class="TestGroup">
        <div class="classTitle">System.IO.MemoryMappedFiles.MemoryMappedFile</div>
        <div class="chart">
            <div class="chart" id="SequenceWrite1K"> </div>
        </div>
        <div class="chart">
            <div class="chart" id="SequenceWrite4K"> </div>
        </div>
        <div class="chart">
            <div class="chart" id="SequenceWrite8K"> </div>
        </div>
        <div class="chart">
            <div class="chart" id="AsyncSequenceWrite1K"> </div>
        </div>
        <div class="chart">
            <div class="chart" id="AsyncSequenceWrite4K"> </div>
        </div>
        <div class="chart">
            <div class="chart" id="AsyncSequenceWrite8K"> </div>
        </div>
    </div>
</body>
</html>